<div class='panel panel-default grid'>
	<div class='panel-heading'>
		<i class='fa fa-credit-card fa-2x' style="margin-right: 10px;"></i>订单列表
        <select name="order_s1" id="order_s1">
        </select>
         	日期:
		<input name="startDate" id="startDate" type="text" placeholder="请选择开始日期">至
		<input name="endDate" id="endDate" type="text" placeholder="请选择结束日期">
		 订单号:<input id="orderId" type="text">
		 用户名:<input id="username" type="text">
        <button onclick="getOrder()">查询</button>
       	<div class='panel-tools'>
       		<div class='btn-group'>
       			<a class='btn' onclick="getOrder()" title='刷新'>
                  <i class='fa fa-rotate-left (alias) fa-2x'></i>
                </a>
       		</div>       		
       	</div>
    </div>
</div>
<div class="menu-body panel panel-default grid">
    <table class="table table-hover">
		<thead>
			<tr><th>订单号</th><th>所属主题</th><th>用户名</th><th>应付金额</th><th>实付金额</th><th>状态</th><th>创建时间</th><th style="width:120px">操作</th></tr>
		</thead>
		<tbody id="tbodyData">
		</tbody>
	</table>
</div>
<script id="order_header" type="text/html">
			<ul>
   			 <li><option value="">全部主题</option></li>
			 {{each themelist as value index}}
			 <li><option value="{{value.themeId}}">{{value.themename}}</option></li>
			 {{/each}}
			</ul>
</script>
<script type="text/html" id="order_js">
{{if list==null || list.length==0 }}
	<div style="color: gray;text-align: center;width:100%">暂无数据</div>
{{else}}
	{{each list as value index}}
	<tr><td>{{value.orderId}}</td><td>{{value.themename}}</td><td>{{value.username}}</td><td>{{value.money}}</td><td>{{value.payment}}</td><td>{{value.status}}</td><td>{{value.createTime}}</td>
		<td class='action'><button class="btn btn-xs btn-info" onclick="getTicket()"><i class="fa fa-search"></i>检票</button></td>	
	</tr>
{{/each}}
{{/if}}
</script>
<script type="text/javascript">
function getOrder(){
		var para={
		};
		if (document.getElementsByName("order_s1")[0]!= undefined) {
		 para.themeId = document.getElementsByName("order_s1")[0].value;
		 }
		if ($("#orderId").val()!= undefined) {
		 para.orderId = $("#orderId").val();
		 }
		if ($("#username").val()!= undefined) {
		 para.username = $("#username").val();
		 }
		if ($("#startDate").val()!= undefined) {
		 para.startDate = $("#startDate").val();
		 }
		if ($("#endDate").val()!= undefined) {
		 para.endDate = $("#endDate").val();
		 }
		callSvr("order/getOrder",para, function(result) {
			var data={
				list:result
			};
			var html=template('order_js',data);
			$("#tbodyData").html(html);
		});
	}

header();
function header(){
	callSvr("eval/header",{}, function(result){
		var data={
			themelist:result
		}
		 var html=template('order_header',data);
		 $("#order_s1").html(html);
	});
}
$(function(){
		$("#endDate").datetimepicker({
			lang:'ch',//中文化
			timepicker:true,//关闭时间选择器
			format:'Y-m-d',//时间格式
			validateOnBlur:false,//插件离开时选择时间
			closeOnWithoutClick:true //点击日历插件外面自动关闭
		});
		$("#startDate").datetimepicker({
			lang:'ch',//中文化
			timepicker:true,//关闭时间选择器
			format:'Y-m-d',//时间格式
			validateOnBlur:false,//插件离开时选择时间
			closeOnWithoutClick:true //点击日历插件外面自动关闭
		});
});
</script>